﻿using System;
using System.Security.Cryptography;
using System.Text;

namespace SoftLab.Clases
{
    public static class Codificador
    {
        public static string EncodeMd5(string originalPassword)
        // ReSharper restore InconsistentNaming
        {
            //Instantiate MD5CryptoServiceProvider, get bytes for original password and compute hash (encoded password)
            MD5 md5 = new MD5CryptoServiceProvider();
            byte[] originalBytes = Encoding.Default.GetBytes(originalPassword);
            byte[] encodedBytes = md5.ComputeHash(originalBytes);

            //Convert encoded bytes back to a 'readable' string
            return BitConverter.ToString(encodedBytes);
        }
    }
}
